www.gusucode.com > 环保时代家庭财务管理系统 EPffms v4.0 > 环保时代家庭财务管理系统 EPffms v4.0\code\eptimehome\admin_upfile.asp

    <!--#include file="admin_inc.asp"-->
<%

viewHead "上传文件管理" & "-" & menuList(8,0)

dim action : action = getForm("action", "get")


Select  case action
	case "del" : delTemplate
	case else : main
End Select 
viewFoot


Sub main
	dim folderList,folderNum,i,folderAttr,fileList,fileNum,j,fileAttr,folder,filedir,filename,lastLevelPath
	dim dirTemplate : dirTemplate="images/bg"
	dim path : path=getForm("path","get") : if isNul(path) then path= dirTemplate
	'if left(path,9)<>"/Upload" then  alertMsg "只允许编辑Upload目录","admin_upfile.asp" : die ""
	folderList= getFolderList(path)
	fileList= getFileList(path)
	folderNum = ubound(folderList)
	fileNum = ubound(fileList)
%>
<div id="append_parent"></div>
<div class="container" id="cpcontainer">
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='首页&nbsp;&raquo;&nbsp;<%=menuList(8,0)%>&nbsp;&raquo;&nbsp;上传文件管理';</script>
<table class="tb2">
<tr class="thead"><th colspan="5">上传文件管理</th></tr>
  <tr>
    <td width="22%"><strong>文件名</strong></td>
	<td width="20%"><strong>文件类型</strong></td>
    <td width="19%"><strong>文件大小</strong></td>
    <td width="17%"><strong>修改时间</strong></td>
    <td width="22%"><strong>操作</strong></td>
  </tr>
	<%
    if right(path,1) ="/" then  path=left(path,len(path)-1)
	lastLevelPath= mid(path,1,instrrev(path,"/")-1)
	
    if  path<>"Upload" then
    %>
    <td  colspan="5">当前目录:<%=path%>&nbsp;&nbsp;&nbsp;&nbsp;	</td>
  <tr align="left" > <td  colspan="5"><a  href="?path=<%=lastLevelPath%>"><img border=0 src='images/last.gif' />上一级目录</a></td></tr>
    <%
	end if
	
	if folderNum >= 0 and instr(folderList(0),",")>0 then
		for i=0 to folderNum
			folderAttr=split(folderList(i),",")
			folder=folderAttr(4)
		%>
	<tr align="left" ><td ><a href="?path=<%=folder%>"><%="<img border=0 src='images/folder.gif'>"&folderAttr(0)%></a></td><td><%=folderAttr(1)%></td><td><%=folderAttr(2)%></td><td><%=folderAttr(3)%></td> <td><a href="?path=<%=folder%>"><img border=0 src='images/next.gif' />下一级目录</a></td></tr>
		<%
		next
	end if
     %>
    <%
	if fileNum >= 0 and instr(fileList(0),",")>0 then
		for j=0 to fileNum
			fileAttr=split(fileList(j),",")
			filedir=fileAttr(4)
			filename=fileAttr(0)
		%>
	<tr align="left" ><td>
			<%
             echo "<a href='"&filedir&"' target=_blank >"&viewIcon(filename)&filename&"</a>"
            %>
      </td><td><%=getTemplateType(filename)%></td><td><%=fileAttr(2)%></td><td><%=fileAttr(3)%></td><td>
			<%
             echo "<a href='"&filedir&"' target=_blank >浏览</a>&nbsp;&nbsp;<a href='?action=del&filedir="&filedir&"'>删除</a>"
            %>
    </td></tr>
		<%
		next
	end if
    %>
</table>
<%
End Sub

Sub delTemplate()
    dim filedir
    filedir=getForm("filedir", "get")
	delFile filedir
	alertMsg "文件删除成功","admin_upfile.asp"
End Sub

Function getTemplateType(filename)
	if instr(filename,".gif")>0 or  instr(filename,".jpg")>0  or  instr(filename,".png")>0  then 
		getTemplateType="图片文件"
	elseif instr(filename,".css")>0 then
		 getTemplateType="样式文件"
	elseif instr(filename,".js")>0 then
		 getTemplateType="脚本文件"
	else
		getTemplateType="其它文件"
	end if
End Function

Function getFileType(filedir)
	dim filetype,imgFileStr,pageFileStr
	filetype=lcase(mid(filedir,instrrev(filedir,".")))
	imgFileStr=".jpg|.jpeg|.gif|.bmp|.png"
	pageFileStr =".html|.htm|.js|.css|.txt"
	if instr(imgFileStr,filetype)>0 then getFileType="img" : Exit Function
	if instr(pageFileStr,filetype)>0 then getFileType="txt" : Exit Function
End Function

Function viewIcon(filename)
	dim fileType,icon
	fileType=mid(filename,instrRev(filename,"."))
	if instr(".js,.css",fileType)>0  then 
		icon="<img  border=0 src='images/"&replace(fileType,".","")&".gif' />"
	else
		if fileType=".jpg" or fileType=".jpeg" then 
			icon="<img border=0 src='images/jpg.gif' />"
		elseif fileType=".htm" or fileType=".html" or fileType=".shtml" then 
			icon="<img border=0 src='images/html.gif' />"
		elseif fileType=".gif" or fileType=".png" then 
			icon="<img border=0 src='images/gif.gif' />"
		else
			icon="<img border=0 src='images/file.gif' />"	
		end if
	end if
	viewIcon = icon
End Function
%>